home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / weight2.doc < prev    next >
Text File  |  1995-03-31  |  4KB  |  91 lines

  1. WEIGHT2, a better Weighted Statistics package, by Joseph K. Horn 
  2. Obsoletes the WEIGHT programs on Goodies Disk #7. 
  3.  
  4. úÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ 
  5. 3 Mini-instructions: Use the normal STAT functions to enter 3 
  6. 3   all your [datum weight] pairs, then press:              3 
  7. 3 WTOT to get the Weighted TOT (sum),                       3 
  8. 3 WMEAN to get the Weighted MEAN (average),                 3 
  9. 3 WSDEV to get the Weighted Sample Standard Deviation, and  3 
  10. 3 WPSDEV to get the Weighted Population Standard Deviation. 3 
  11. àÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄù 
  12.  
  13. Background: When you have discrete data, the built-in MEAN and SDEV 
  14. functions suffice.  But they are unsatisfactory for data which have 
  15. different "weights" (that is, different levels of importance), or 
  16. different "frequencies" (that is, each datum occurs not just once, but 
  17. a different number of times). 
  18.  
  19. The WEIGHT programs on Goodies Disk #7 assumed that the data 
  20. frequencies were small.  Meanwhile, Geir Atle Storhaug asked how to 
  21. handle extreme cases like this: 
  22.  
  23.        DATUM   FREQUENCY 
  24.        -----   --------- 
  25.         1        9982 
  26.         1.5      8733 
  27.         2        8337 
  28.         2.5      1973 
  29.         3        1278 
  30.  
  31.     Note: this data can either mean (1) you have only 5 data (namely 
  32.     1, 1.5, 2, 2.5, and 3), but the 1 is the most important, with a 
  33.     "weight" of 9982, and 3 is the least important, with a weight of 
  34.     only 1278; or (2) you have 30303 data, namely nine thousand nine 
  35.     hundred eighty two 1's, eight thousand seven hundred thirty three 
  36.     1.5's, and so on.  The real world problems in which such data 
  37.     arise might seem totally different.  They are mathematically 
  38.     identical, however.  Both are called "grouped data" in the 
  39.     literature, and the statistical equations are the same. 
  40.  
  41. With huge frequencies like this, the WEIGHT program would fail.  It's 
  42. easy to see that the HP 48 cannot hold all these as discrete values in 
  43. a gargantuan äDAT; it would require half a megabyte of RAM!  (Even if 
  44. it were possible, the HP48 would take forever to calculate the results 
  45. from such a huge äDAT).  And the WEIGHT program assumed that weights 
  46. are always integers, which is not a reasonable assumption. 
  47.  
  48. So here are new, improved MEAN and SDEV routines for weighted data, 
  49. and the nice thing is that you can enter your data exactly as shown 
  50. above: as [ DATUM  FREQUENCY ] pairs.  This way, the above example can 
  51. reside in a äDAT that's only 95 bytes (!) and the results are fast. 
  52.  
  53. Example: 
  54.  
  55.     Enter the data shown above. 
  56.  
  57.         WEIGHT             Puts you into the WEIGHT directory 
  58.         STAT  CLä          Clears äDAT 
  59.         [ 1  9982  ä+      Stores first [ datum weight ] pair 
  60.         1.5  8733  ä+ 
  61.         2    8337  ä+ 
  62.         2.5  1973  ä+ 
  63.         3    1278  ä+      Stores last [ datum weight ] pair 
  64.         VAR                See the WEIGHT programs 
  65.  
  66.     Find the total (sum) of the data: 
  67.  
  68.         WTOT    --> 48522 
  69.  
  70.     Find the mean (average) of the data: 
  71.  
  72.         WMEAN    --> 1.60122760123 
  73.  
  74.     Find the sample standard deviation of the data: 
  75.  
  76.         WSDEV    --> .548539390967 
  77.  
  78.     Find the population standard deviation of the data: 
  79.  
  80.         WPSDEV    --> .548530339979 
  81.          
  82. These programs run almost as fast as the built-in TOT, MEAN and SDEV, 
  83. and they're quite small, even though they're 100% User RPL. 
  84.  
  85. Note: The WPSDEV program cannot be extracted from this directory and 
  86. used alone, because it requires the WMEAN and WSDEV programs.  The 
  87. other programs in this directory, however, can be extracted from the 
  88. directory and used as stand-alone programs. 
  89.  
  90. -Joseph K. Horn-   -Peripheral Vision, Ltd.- 
  91.